﻿using Application.DTO;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;

namespace Application.IService
{
    public interface IBaseService<T> where T : class
    {
        /// <summary>
        /// 图片上传
        /// </summary>
        /// <param name="file">图片文件</param>
        /// <returns></returns>
        public string UpLoad(IFormFile file);
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">实体信息</param>
        public Task<int> Insert(T entity);
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="entities">实体信息集合</param>
        public Task<int> InsertBatch(List<T> entities);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity">实体信息</param>
        public Task<int> Update(T entity);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="entities">实体信息集合</param>
        public Task<int> UpdateBatch(List<T> entities);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">实体信息</param>
        public Task<int> Delete(T entity);
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="entities">实体信息结合</param>
        public Task<int> DeleteBatch(List<T> entities);
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public Task<IQueryable<T>> GetAll();
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageSize">每页显示数据条数</param>
        /// <param name="pageIndex">当前页页码</param>
        /// <returns></returns>
        public Task<PageDTO<T>> GetAll(int pageSize, int pageIndex);
    }
}